import { initializeScrollPosition, initializeTasks, initializeZRender } from "./modules/initialization";
import { ChartRenderer } from './modules/chart-renderer';

class GanttApp {
  // ZRender实例
  private zr: any;
  // 任务数据
  private tasks: any;
  // 滚动位置
  private scrollState: ScrollState;
  // 图表渲染器
  private chartRenderer: ChartRenderer | null;

  constructor() {
    this.scrollState = {
      lastScrollX: 0,
      lastScrollY: 0
    };
    this.chartRenderer = null;
  }

  init() {
    // 初始化ZRender
    this.zr = initializeZRender();

    // 初始化数据
    this.tasks = initializeTasks();

    // 初始化滚动位置
    this.scrollState = initializeScrollPosition();

    // 创建图表渲染器
    this.chartRenderer = new ChartRenderer(this.zr, this.tasks, this.scrollState);
    this.chartRenderer.draw(true);
  }
}

const app = new GanttApp();
app.init();